package version2024.easy;

import java.util.Scanner;

/**
 * @author sunhl
 * @Description: HJ56 完全数计算
 * @Date: created in 2025/1/15 星期三 0:51
 * @Modified By:
 */
public class HJ56_PerfectNumberCalculation {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        // 注意 hasNext 和 hasNextLine 的区别
        while (in.hasNextInt()) { // 注意 while 处理多个 case
            int n = in.nextInt();

            //第一个完全数是6，若小于6则输出0
            if (n < 6) {
                System.out.println(0);
                continue;
            }

            int count = 0;    //计数变量
            for (int t = 6; t <= n; t++) {
                int sum = 0;
                //统计因数的和，计数到该数的1/2即可
                for (int i = 1; i <= t / 2; i++) {
                    if (t % i == 0)
                        sum += i;
                }
                if (sum == t)
                    count++;
            }

            System.out.println(count);
        }
    }
}
